package com.lh_travel.lohas.activity.user;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ListView;

import com.lh_travel.lohas.R;
import com.lh_travel.lohas.adapter.CommonAdapter;
import com.lh_travel.lohas.adapter.ViewHolder;
import com.lh_travel.lohas.base.baseActivity;

import java.util.ArrayList;

public class LanActivity extends baseActivity {

    private Toolbar toolbar;
    private ImageButton img_back;
    private ListView lv_lan;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_lan);

        findView();
        bindListner();
        ensureUI();
    }

    @Override
    public void findView() {
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        lv_lan = (ListView) findViewById(R.id.lv_lan);
        img_back = (ImageButton) findViewById(R.id.img_back);
    }

    @Override
    public void bindListner() {
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void ensureUI() {

        setSupportActionBar(toolbar);
        toolbar.setEnabled(true);

        ArrayList<String> lanArr = new ArrayList<>();

        lanArr.add("中文");

        CommonAdapter<String> adapter = new CommonAdapter<String>(mContext, lanArr, R.layout.item_tips) {
            @Override
            public void convert(ViewHolder helper, String item, int position) {

                helper.setText(R.id.tv_title, item);

            }
        };

        lv_lan.setAdapter(adapter);

        lv_lan.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                finish();
            }
        });
    }

}
